{extend name='Public:content'/}
{block name='title'}管理员管理{/block}
{block name='content'}
<div class="row animated fadeIn">
    <div class="row">
        <div class="col-md-9">
            <div class="panel panel-default tabs">
                <ul class="nav nav-tabs" role="tablist">
                    <li class="active"><a href="#tab-first" role="tab" data-toggle="tab">管理员列表
                        <button class="btn btn-success btn-rounded btn-sm">{$admin_nums}</button>
                    </a></li>
                    <li><a href="#tab-second" role="tab" data-toggle="tab">添加管理员</a></li>
                </ul>
                <div class="panel-body tab-content">
                    <div class="active tab-pane" id="tab-first">
                        <table class="table table-hover">
                            <thead>
                            <tr>
                                <th>登陆名</th>
                                <th>头像</th>
                                <th>登录次数</th>
                                <th>角色</th>
                                <th>注册时间</th>
                                <th>最近登录IP</th>
                                <th>最近登录时间</th>
                                <th>状态</th>
                                <th></th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name='admin_list' id='v'}
                            <tr class="del_tr">
                                <td>{$v.user_login}</td>
                                <td  style="background: url('{$v.avatar|is_img}');background-size: contain;background-repeat: no-repeat;"></td>
                                <td><span class="label label-danger">{$v.user_hits}</span></td>
                                <td><span class="label label-info">{$v.id|get_role}</span></td>
                                <td>{$v.create_time|tranTime}</td>
                                <td>{$v.last_login_ip}</td>
                                <td>{$v.last_login_time|tranTime}</td>
                                <td>{$v.user_status|is_stop}</td>
                                <td>
                                    {if condition='$v.id eq 1'}
                                    {if condition='open_secret($Think.cookie.UID) neq 1'}
                                        <a disabled title="{$v.user_login}【编辑】"  class="btn btn-default btn-rounded btn-sm"><span class="fa fa-pencil"></span></a>
                                        {else/}
                                        <a title="{$v.user_login}【编辑】" data-url="{:url('admin/Admin/edit_page',['id'=>$v.id])}" onclick="edit_row(this)"  class="btn btn-default btn-rounded btn-sm"><span class="fa fa-pencil"></span></a>
                                    {/if}
                                      <button disabled class="btn btn-danger btn-rounded btn-sm" ><span class="fa fa-trash-o"></span></button>
                                    {else/}
                                    <a title="{$v.user_login}【编辑】" data-url="{:url('admin/Admin/edit_page',['id'=>$v.id])}" onclick="edit_row(this)"  class="btn btn-default btn-rounded btn-sm"><span class="fa fa-pencil"></span></a>
                                    <button data-url="{:url('admin/Admin/del_think',['id'=>$v.id])}" onClick="delete_row(this);" class="btn btn-danger btn-rounded btn-sm" ><span class="fa fa-trash-o"></span></button>
                                    {/if}
                                </td>
                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                        {$pages}
                    </div>
                    <div class="tab-pane" id="tab-second">
                        <form id="add_form" action="{:url('admin/Admin/add_think')}" method="post" class="form-horizontal">
                            <div class="panel-body">
                                <div class="row">
                                    <div class="col-md-10">
                                        <div class="form-group">
                                            <label class="col-md-3 control-label">头像</label>
                                            <div class="col-md-7">
                                                <div class="gallery">
                                                    <a class="gallery-item"  href="javascript:void('')" title="Space picture 2" data-gallery>
                                                        <div class="image" >
                                                            <input hidden name="avatar" type="text" id="inp">
                                                            <img src="__UPLOAD__/admin/common/upload.svg" alt="Space picture 2"/>
                                                            <ul class="gallery-item-controls">
                                                                <li onclick="upload_single('inp','avatar')"><i class="fa fa-cloud-upload"></i></li>
                                                                <li onclick="del_pic('inp')"><i class="fa fa-times"></i></li>
                                                            </ul>
                                                        </div>
                                                    </a>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-md-3 control-label">登录名</label>
                                            <div class="col-md-9">
                                                <input name="user_login" type="text" class="form-control"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-md-3 control-label">密码</label>
                                            <div class="col-md-9">
                                                <input name="user_pass" type="password" class="form-control"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-md-3 control-label">确认密码</label>
                                            <div class="col-md-9">
                                                <input name="confirm_pass" type="password" class="form-control"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-md-3 control-label">邮箱</label>
                                            <div class="col-md-9">
                                                <input name="user_email" type="text" class="form-control"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-md-3 control-label">角色</label>
                                            <div class="col-md-9">
                                                <select name="role_id" class="form-control select">
                                                    {volist name='role_list' id='v'}
                                                    <option value="{$v.id}">{$v.name}</option>
                                                    {/volist}
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-md-3  control-label">管理员状态</label>
                                            <div class="col-md-9">
                                                <label class="switch">
                                                    <input name="user_status" type="checkbox" checked value="1"/>
                                                    <span></span>
                                                </label>
                                                <span class="help-block">默认正常</span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="panel-footer">
                                <button class="btn btn-info pull-right">保存添加<span class="fa fa-floppy-o fa-right"></span></button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">

</script>
{/block}